# Copyright (C) 2006  Apptility LLC  http://www.apptility.com
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

require 'yaml'
require 'singleton'
require 'logger'

# Bootstrap the OpenAppDotOrg/Ajuby's App config properties and then you can use this 
# anywhere in the controller/view by saying AJUBY_CONFIG['configvar']
# the reason to have a seperate yml file than using environment.rb
# - Environment.rb is Ruby file , and we truly need a configuration file like yml style
#   so that reading and manipulation of this file is easier as compared to changing /rb file
# - Idealy we would like Ajuby specific properties in a seperate file , rather than keeping OOTB
#   Rails app property file (environment.rb)
AJUBY_CONFIG = YAML::load(File.open("#{RAILS_ROOT}/config/appconfig/ajubyconfig.yml"))

require 'ajuby_logger'
class AjubyGlobalConfig  
    include Singleton  

    #Init Data auth functional modules
    def init_functional_modules_list functional_modules_list
      @functional_modules_list = functional_modules_list
      AjubyLogger.logInfo "[AjubyGlobalConfig] Initializing Data Authorization Functional Modules List..."
    end

    def functional_modules_list
      @functional_modules_list
    end
    
    #Init Data auth actions
    def init_data_auth_actions data_auth_actions
      @data_auth_actions = data_auth_actions
      AjubyLogger.logInfo "[AjubyGlobalConfig] Initializing Data Authorization Actions..."
    end

    def data_auth_actions
      @data_auth_actions
    end
    
   
end  

AjubyLogger.logInfo "[AjubyGlobalConfig] Application Initialization...."


# Bootstrap the Ajuby's UI Framework
# require File.join(File.dirname(__FILE__), '/uiframework/init')
require ('uiframework/init')
  

  
 